<template>
  <article-detail :article="article" />
</template>

<script>
import ArticleDetail from './components/ArticleDetail'
import { fetchArticle } from "@/api/article";

export default {
  name: 'CreateArticle',
  components: { ArticleDetail },
  data() {
    return {
      article: {
        id: '',
        title: '',
        content: ''
      }
    }
  },
  created() {
  },
  mounted() {
    this.fetchArticle(this.$route.query.id)
  },
  methods: {
    async fetchArticle(id) {
      this.loading = true
      const data = await fetchArticle(id)
      this.loading = false

      this.article = {
        id: data.data.id,
        title: data.data.title,
        connect: data.data.connect
      }
      console.log(this.article)
    }
  }
}
</script>
